New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CLI: Workaround for react native sb init
#12405
Conversation
import { JsPackageManager } from '../../js-package-manager'; | ||
import { NpmOptions } from '../../NpmOptions'; | ||
import { GeneratorOptions } from '../baseGenerator'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is baseGenerator
still used anywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GeneratorOptions is the type for the options parameter on the generator function other than that it's not used
sb init
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @dannyhw! 🙌
CLI: Workaround for react native `sb init`
Issue: #12334
Also various issues from http://github.com/storybookjs/react-native are probably resolved by this
What I did
I changed the react native generator to work specifically for react native. There are currently some special cases for react native that aren't worth implementing on the base generator because they could be solved with a v6 of react native.
I also made some changes to simplify the examples.
How to test my changes
You can try out the changes by generating a new react native project and then running the cli index.js with node from inside the react native project. Here is a brief explanation on how you can do that:
from this repo build the cli
Install the expo cli (if you already have expo cli installed you can skip this step)
Generate a react native project with expo.
It would be ideal to do this near the storybook repo so the file path is easier to figure out
Within the terminal navigate to the react native project
cd myNewProject
Run the local build of the cli
choose yes when prompted to install the storybook server
the package.json should have the following dependencies added
the storybook command should also be added to the scripts in package json
To run the project delete the contents of app.js and add the following
export {default} from './storybook';
Then you can check the ondevice ui with
yarn web
oryarn ios
oryarn android
.If you don't have a simulator setup I recommend using
yarn web
since it should work regardless.Check the server with
yarn storybook